#pragma once
#include "../basic/types.h"
#include <Windows.h>
#include <optional>
#include <string>

size_t string_to_bytes(IN std::string sign, IN OUT short *dest);

bool cmp_sign(short *sign, byte *buf, size_t len);

std::optional<std::pair<uint64, uint64>> get_module_addr(uint32 pid);

std::optional<uint64> get_module_base(uint32 pid);

uint64 scan_raw_addr(HANDLE process, uint64 start, uint64 end, std::string sign,
                     int line_offset);

uint64 scan_raw_addr_rva(HANDLE process, uint64 start, uint64 end,
                         std::string sign, int line_offset);

uint64 scan_raw(HANDLE process, uint64 start, uint64 end, std::string sign,
                int line_offset, uint32 inline_offset, uint32 cmd_len);

uint64 scan_call(HANDLE process, uint64 start, uint64 end, std::string sign,
                 int line_offset /*, uint32 inlineOffset, uint32 cmdSize*/);

uint64 scan_base(HANDLE process, uint64 start, uint64 end, std::string sign,
                 int line_offset, uint32 inline_offset /*, uint32 cmdSize*/);

uint64 scan_offset(HANDLE process, uint64 start, uint64 end, std::string sign,
                   int line_offset, uint32 inline_offset, uint32 cmd_len);

uint64 scan_base_in_call(HANDLE process, uint64 start, uint64 end,
                         std::string sign, int line_offset,
                         uint32 call_line_offset, uint32 call_inline_offset);
